#include "HString.h"
void main()
{
	HString s0("I love you!"),s1, s2('p');
	cout<<"Be initialized by char *,s0:"<<s0;
	cout<<"Be constructed by default constructor,s1:"<<s1;
    cout<<"Be initialized by char,s2:"<<s2;

	s1=s0;
 	cout<<"= overload s1:"<<s1;

	s2="I love you too!";
	cout<<"= overload s2:"<<s2;

	HString s3=s1;
	cout<<" copy constructor,s3:"<<s3;
    
	s3=s0+s1+s2;
	cout<<"The member function:overload +:"<<s3;
     
	s3+=(s1+=s0);
	cout<<"The member function:overload +=:"<<s1;
    cout<<"The member function:overload +=:"<<s3;

	s1=s3(2,4);
	cout<<"The member function:()overload:"<<s1;

	cout<<"s3:"<<s3;
	cout<<"s1:"<<s1;
	cout<<"First position of s1 in s3:"<<s3.Index(s1,0)<<endl;
	cout<<"Second position of s1 in s3:"<<s3.Index(s1,6)<<endl;
	
	cout<<"First position of 'y' in s3:"<<s3.Index('y',0)<<endl;
	cout<<"Second position of'y' in s3:"<<s3.Index('y',10)<<endl;

	if(StrCompare(s2,s1))
		cout<<"The function StrCompare:S2 >s1"<<endl;

	s1[1]='p';
	cout<<"After use operator[] of s1:"<<s1;

	if(!(s1==s2))
	cout<<"== overload : s1!=s2."<<endl;
    
	HString s4="am hating";
	cout<<"s1:"<<s1;
	cout<<"s2:"<<s2;
	cout<<"s4:"<<s4;
    s1(0,0)=s2(2,4)=s4;
	cout<<"after use s1(0,0)=s2(2,4)=s4:\ns1:"<<s1<<"s2"<<s2;

	s4.Insert("I ",0);
	s4+=" you very much!";
	cout<<"Member function Insert:s4:"<<s4;
	s4.Remove(0,7);
	cout<<"Member function Remove:s4:"<<s4;
}
